let list = ['b', 'd', 'mm']

const nextObj = (obj, key) => obj[key] = obj[key] || {}

//循环读取属性值
let data = {b: {d: {mm: "123123"}}}
console.log(data['b']['d']['mm'])
let mmValue = "";
list.forEach((key, index) => {
  mmValue = nextObj(index == 0 ? data : mmValue, key)
})
console.log("mmValue", mmValue)

//循环生成多级对象
let newObj = {}, nextValue = ""
list.forEach((key, index) => {
  nextValue = nextObj(index == 0 ? newObj : nextValue, key)
})

console.log(newObj)

